<template>
  <div class="home">
   <div class="row food">
     <div class="col-md-12">
        <router-link class="parent" v-for="food in result" :key="food.classid" :to="{name:'FoodList',query:{classid:food.classid}}">
          <p>{{food.name}}</p>
          <router-link v-for="f in food.list" :key='f.classid' :to="{name:'FoodList',query:{classid:f.classid}}" class="detail">
            <span>{{f.name}}</span>
          </router-link>
        </router-link>
     </div>
   </div>
  </div>
</template>
<script>
import { getAllTypes, getFoodsByPage, getFoodDetail, getFoodByKeyWord } from '../services/foods';
export default {
  name: "Home",
  data() {
    return {
      result: [],
    };
  },
  created() {
      getAllTypes()
      .then((res) => {
        console.log(res)
        this.result = res.data.result;
      })
    }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.food{
  border-bottom: 1px solid #aaa;
  box-shadow: 2px 0px 2px;
  padding: 0.5rem;
}
.food .parent{
  width: 100%;
}
.food .parent p{
  font-size: 2rem;
}
.food span{
  display: inline-block;
  padding: 5px;
  border: 1px solid #aaa;
}
</style>
